package org.deltaset.secured.example;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;

/**
 *
 * @author dmakariev
 */
@Entity
public class DeletableParent extends AbstractParent<DeletableParent,DeletableChild>{

    @OneToMany( fetch = FetchType.EAGER,mappedBy="parent", cascade = CascadeType.ALL, orphanRemoval=true)
    private Set<DeletableChild> children;

    @Override
    public Set<DeletableChild> getChildren() {
        if(null==children){
            children = new HashSet<DeletableChild>();
        }
        return children;
    }

    @Override
    public DeletableChild newChild(String childName) {
        return new DeletableChild(childName);
    }

    @Override
    public DeletableParent addNumberOfChildren(int numberOfChildren) {
        return super.addChildren(numberOfChildren);
    }


    
}
